<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@page isELIgnored="false" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <base href="<%=basePath%>">
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>修改密码</title>
    <link rel="stylesheet" href="render/css/frontend/common/base.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/common/shop_common.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/shop_header.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/shop_manager.css" type="text/css"/>
    <link rel="stylesheet" href="render/css/frontend/shop_form.css" type="text/css"/>

    <script type="text/javascript" src="render/js/jquery.min.js"></script>
<%--    <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>--%>
</head>
<body>
<!-- Header Start -->
<jsp:include page="common/head.jsp"></jsp:include>

<!-- TopHeader Center -->
<jsp:include page="common/topheader_center.jsp"></jsp:include>
<!-- TopHeader Center End -->

<!-- Header Menu -->
<jsp:include page="common/header_menu.jsp"></jsp:include>
<!-- Header Menu End -->

<div class="shop_hd_breadcrumb">
    <strong>当前位置：</strong>
    <span>
        <a href="/">首页</a>&nbsp;›&nbsp;
        <a href="/render/myhome">个人中心</a>&nbsp;›&nbsp;
        <a href="/render/password_edit">修改密码</a>
    </span>
</div>
<div class="clear"></div>
<!-- 面包屑 End -->
<!-- Header End -->

<!-- 我的个人中心 -->
<div class="shop_member_bd clearfix">
    <!-- 左边导航 -->
    <jsp:include page="common/myshop_left.jsp"></jsp:include>
    <!-- 左边导航 End -->

    <!-- 右边购物列表 -->
    <div class="shop_member_bd_right clearfix">

        <div class="shop_meber_bd_good_lists clearfix">
            <div class="title"><h3>修改密码</h3></div>
            <div class="clear"></div>
            <div class="shop_home_form">
                <form action="" name="" class="shop_form" method="post">
                    <ul>
                        <li class="bn"><label>原密码：</label><input type="password" id="old_password" class="truename form-text"/></li>
                        <li class="bn"><label>新密码：</label><input type="password" id="new_password_one" class="truename form-text"/></li>
                        <li class="bn"><label>重复新密码：</label><input type="password" id="new_password_two" class="truename form-text"/></li>
                        <li class="bn"><label>&nbsp;</label><input type="button" class="form-submit" value="保存修改"/></li>
                    </ul>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 右边购物列表 End -->
<!-- 我的个人中心 End -->

<!-- Footer - wll -->
<jsp:include page="common/footer.jsp"></jsp:include>
<!-- Footer End -->
<script type="text/javascript">
    $(function () {
        var updateUrl="/render/user/update_userInfo";
        $(".form-submit").click(function () {
            var old_password = $('#old_password').val();
            var new_password_one = $('#new_password_one').val();
            var new_password_two = $('#new_password_two').val();
            if (new_password_one == null||new_password_two == null) {
                return HFalert({title: "新密码不能为空", type: 'warning', confirmButtonText: '确定'});
            }
            if (new_password_one != new_password_two) {
                return HFalert({title: "新密码不一致", type: 'warning', confirmButtonText: '确定'});
            }
            // 访问后台进行登录验证
            $.ajax({
                url : updateUrl,
                async : false,
                cache : false,
                type : "post",
                dataType : 'json',
                data : {
                    old_password:old_password,
                    password:new_password_two
                },
                success : function(data) {
                    if (data.success) {
                        HFalert({title: data.message, type: 'success', confirmButtonText: '确定'});
                    } else {
                        HFalert({title: data.message, type: 'warning', confirmButtonText: '确定'});
                    }
                }
            });
        });
    })
</script>
</body>
</html>